package com.ruoyi.system.enums;

import com.ruoyi.common.utils.StringUtils;

public enum ChinaMediaTypeEnum {
    news("news", "新闻",2001),
    blog("blog", "博客",2002),
    forum("forum", "论坛",2003),
    microBlog("microBlog", "微博",2004),
    weChat("weChat", "微信",2005),
    electronicNewspaper("electronicNewspaper", "电子报",2007),
    video("video", "视频",2008),
    app("app", "APP",2009),
    postsBar("postsBar", "贴吧",2010),
    interLocution("interLocution", "问答",2011),
    shortVideo("shortVideo", "短视频",2012),
    comprehensive("comprehensive", "综合",2999);




    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public int getCarrie() {
        return carrie;
    }

    public static String getNameByValue(String value){
        for (ChinaMediaTypeEnum mediaTypeEnum : ChinaMediaTypeEnum.values()) {
            if (StringUtils.equals(mediaTypeEnum.getValue(), value)) {
                return mediaTypeEnum.getName();
            }
        }
        return "其他";
    }

    public static String getNameByCarrie(int carrie){
        for (ChinaMediaTypeEnum mediaTypeEnum : ChinaMediaTypeEnum.values()) {
            if (mediaTypeEnum.getCarrie()==carrie) {
                return mediaTypeEnum.getName();
            }
        }
        return "其他";
    }


    public static int getCarrieByName(String name){
        for (ChinaMediaTypeEnum mediaTypeEnum : ChinaMediaTypeEnum.values()) {
            if (StringUtils.equals(mediaTypeEnum.getName(), name)) {
                return mediaTypeEnum.getCarrie();
            }
        }
        return 0;
    }

    public final String value;
    public final String name;
    public final int carrie;

    ChinaMediaTypeEnum(String value, String name,int carrie) {
        this.value = value;
        this.name = name;
        this.carrie = carrie;
    }
}
